package com.egg.auth.feign;

import com.egg.auth.feign.fallback.AuthUserFeignClientFallback;
import com.egg.auth.model.LoginUserInfo;
import com.egg.auth.model.request.web.UserPagePostFeign;
import com.egg.auth.model.response.web.UserPage;
import com.egg.common.core.model.response.PageData;
import com.egg.common.core.model.response.ResponseData;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient(
        value = "auth"
        , url = "${api.feign.url.auth:}"
        , fallbackFactory = AuthUserFeignClientFallback.class
)
public interface AuthUserFeignClient {


    /**
     * 请求参数不可控，需要使用 POST 类型，否则feign调用会有异常
     *
     * @param param
     * @return
     */
    @PostMapping("/feign/user/page")
    ResponseData<PageData<UserPage>> userPagePost(@RequestBody UserPagePostFeign param);

    @GetMapping("/feign/user/login/info/token")
    ResponseData<LoginUserInfo> userLoginInfoByToken(@ApiParam(value = "令牌", required = true) @RequestParam(value = "token") String token);


}
